package com.google.code.rsser.dao.hibernate;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.google.code.rsser.dao.UserDAO;
import com.google.code.rsser.model.User;

@Repository("userDAO")
public class HibernateUserDAO extends AbstractGenericHibernateDAO<User> implements UserDAO {

	@SuppressWarnings("unchecked")
	public User getByLogin(String login) {
		List<User> users = getHibernateTemplate().find("FROM User u WHERE u.login = ?", login);
		
		return users.size() > 0 ? users.get(0) : null;
	}

}
